using System;
using System.Collections.Generic;
using Core.GameObjects.Entities;
using Core.GameObjects.Stats;

namespace Core.GameObjects.Skills
{
    public enum SkillTypes
    {
        Interactive,
        NonInteractive
    }
    public struct MinMaxBonus
    {
        public int Min;
        public int Max;
        public int Amount;

        public bool IsValueInRange(int value)
        {
            return (value >= Min && value <= Max);
        }
    }

    public enum Difficulty
    {
        Impossible = -50,
        VeryHard = -25,
        Hard = -10,
        Normal = 0,
        Easy = 10,
        VeryEasy = 25
    }

    public class Skill
    {
        /// <summary>Skills ID</summary>
        public int ID { get { return _ID; } }
        /// <summary>Skills Name</summary>
        public string Name { get { return _Name; } set { if (value.Length > 0) _Name = value; } }
        /// <summary>Description of Skill</summary>
        public string Description { get { return _Description; } set { if (value.Length > 0) _Description = value; } }
        /// <summary>Interactive or NonInteractive skill</summary>
        public SkillTypes SkillType { get { return _SkillType; } set { _SkillType = value; }}
        /// <summary>Is Skill Always Active</summary>
        public bool AlwaysActive { get { return _AlwaysActive; } set { _AlwaysActive = value; } }
        /// <summary>Stats that Affect this skill, where Int is Modifier</summary>
        public Dictionary<Stat, int> AffectingStats { get { return _AffectingStats; } set { _AffectingStats = value; } }
        /// <summary>Stats that Limit this skill, where int is Limiter</summary>
        public Dictionary<Stat, int> LimitingStats { get { return _LimitingStats; } set { _LimitingStats = value; } }


        private int _ID;
        private String _Name;
        private String _Description;
        private SkillTypes _SkillType;
        private bool _AlwaysActive;

        private Dictionary<Stat, int> _AffectingStats;
        private Dictionary<Stat, int> _LimitingStats;

        public Skill(int id)
        {
            _AffectingStats = new Dictionary<Stat, int>();
            _LimitingStats = new Dictionary<Stat, int>();
            _AlwaysActive = false;

            _ID = id;

        }

        public bool Use(ref Object target, ref Entity caster, Difficulty difficulty, ref int result)
        {

            //int roll;
            //int bns = 0;

            //roll = GlobalFunctions.GetRandomNumber(DieType.d100);

            //roll += (Int16)difficulty;

            //switch (_Type)
            //{
            //    case SkillType.Defensive:
            //        {
            //            roll += ((Entity)target).GetTotalOffBonus();
            //            break;
            //        }
            //    case SkillType.NonCombat:
            //        {
            //            roll += ((Entity)target).GetTotalMiscBonus();
            //            break;
            //        }
            //    case SkillType.Offensive:
            //        {
            //            roll += ((Entity)target).GetTotalDefBonus();
            //            break;
            //        }
            //}

            //roll += bns;

            //result = roll;

            //if (roll >= 100)
            //    return true;
            //else
                return false;

        }
    }
}
